# Author：liyimei
# Time：2023/5/17 19:10
import time

from selenium.webdriver.common.by import By

from common.base import Base


class LoginPage(Base):
    def input_username(self, username):
        self.find_element((By.NAME, 'username')).send_keys(username)

    def input_password(self, password):
        self.find_element((By.NAME, 'password')).send_keys(password)

    def remember(self):
        self.click((By.ID, 'remember'))

    def login_btn(self):
        self.click((By.CLASS_NAME, 'login_btn'))

    def maximize_window(self):
        self.driver.maximize_window()


if __name__ == '__main__':
    login = LoginPage('chrome')
    login.get('https://ecshop.test2.shopex123.com/user.php')
    login.maximize_window()
    # 正向的测试用例
    time.sleep(3)
    login.input_username('fine1')
    login.input_password('123456')
    login.remember()
    login.login_btn()
    time.sleep(3)
